/*********************************************************************************
Organization 					: 				Georgia Institute of Technology
  
Institute 						:				Cognitive Computing Group(CCL)
 
Authors							: 				Santiago Ontanon, Kinshuk Mishra
 												Neha Sugandh 
 												
Class							:				AttemptLimitCondition
 
Function						: 				Provides a class for holding 
												an Attempt limit condition i.e 
												the number of times a plan is attempted
****************************************************************************/
package planninglanguage.conditions;

import org.jdom.Element;

import util.XMLWriter;


public class AttemptLimitCondition extends Condition {
	int m_limit;
	
	public AttemptLimitCondition(int a_limit)
	{
		m_limit = a_limit;
	}
	public String toString(int tabs) {
		String n = super.toString();
		n = "Attempt Limit is:" + m_limit;
		return n;
	}
	
	public void writeXML(XMLWriter w) {
		w.tag("condition type=\""+this.getClass().getSimpleName()+"\"");
		{
			w.tag("limit", m_limit);
		}
		w.tag("/condition");
	}
	
	protected static AttemptLimitCondition loadConditionFromXML(Element e) {
		return new AttemptLimitCondition(Integer.parseInt(e.getChildText("limit")));
	}
}
